﻿using System;
using log4net;
using NHibernate;
using NHibernate.Linq;
using Ninject;

namespace Machinery
{
    public abstract class Cog : IPart
    {

        [Inject]
        public virtual IKernel Kernel { get; set; }
        public virtual T Get<T>()
        {
            return Kernel.Get<T>();
        }
        public virtual ISession Database {
            get
            {
                return Kernel.Get<ISession>();
            }
        }

        public virtual INHibernateQueryable<T> DatabaseTable<T>()
        {
            return Kernel.Get<ISession>().Linq<T>();
        }


        
    }
}
